<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var reg = /(.*?(小明).*?(26))/g;
    var s = '小明今年26';//021 23442344
    var r = s.match(reg);
    console.log(r);

       var r2 = s.replace(reg,'张$2,今年$3岁');
    console.log(r2);
</script>
</body>
</html>